import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import AMap from 'vue-amap';
import axios from 'axios'
import Qs from 'qs'
import VueAwesomeSwiper from 'vue-awesome-swiper';
import 'swiper/dist/css/swiper.css';
import ddVueCalendar from "dd-vue-calendar";
import "dd-vue-calendar/lib/calendar.css";
import BaiduMap from 'vue-baidu-map';
import  {  getToken  }  from  '@/utils';
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant);
Vue.use(ddVueCalendar)
    // Vue.use(axios);
Vue.config.productionTip = false

// Vue.prototype.axios = store
// Vue.prototype.qs = Qs
Vue.use(BaiduMap, {
    // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
    ak: 'LrN80yZUg2OYHAGhGGolPz44'
})
router.beforeEach((to, from, next) => {
    if (to.matched.some(record => record.meta.requireLogin)) { // 判断该路由是否需要登录权限
        if (getToken('token')) { // 判断当前用户的登录信息loginInfo是否存在
            next();
        } else {
            next({
                path: '/Login/Phonelogin'
            })
        }
    } else {
        next();
    }

})

new Vue({
    router,
    store,
    axios,
    render: h => h(App)
}).$mount('#app')